import React from "react"

import { SFormItem } from "@/components/common"
import StyleSelect from "@/components/common/styleSelect"
import { useLocale, useOptions } from "@/hooks"

const VirtualProtocolSelect = ({ rules, disable, labelProps, selectorProps, name }: any) => {
	const { formatMessage } = useLocale()

	const options = useOptions({
		modal: "virtualProtocolType",
		func: formatMessage
	})

	const optionsFormat = options.map((item: any) => {
		return {
			label: item.label,
			value: item.label
		}
	})

	return (
		<SFormItem
			name={name || "virtualProtocol"}
			rules={rules}
			{...labelProps}
			label={formatMessage({ id: "member.virtual_protocol" })}
		>
			<StyleSelect
				placeholder={formatMessage({ id: "common.select_all" })}
				allowClear
				options={optionsFormat}
				disable={disable}
				{...selectorProps}
			/>
		</SFormItem>
	)
}

export default VirtualProtocolSelect
